﻿using NewLife.Net;
using System;
using System.Threading.Tasks;

namespace TK.Socket
{
    /// <summary>
    /// socket server
    /// </summary>
    public class AppServer : NetServer<AppSession>
    {
        /// <summary>
        /// ctor
        /// </summary>
        public AppServer()
        {
        }

        /// <summary>
        /// 数据接收
        /// </summary>
        public event Action<DataPacket> ReceiveData;

        /// <summary>
        /// 内部socket数据返回
        /// </summary>
        public Task CallbackData(DataPacket data)
        {
            ReceiveData?.Invoke(data);
            return Task.CompletedTask;
        }

        /// <summary>
        /// 释放所有资源
        /// </summary>
        public void DisposeAll()
        {
            base.Dispose(true);
        }
    }
}
